﻿using Microsoft.Extensions.Caching.Memory;

namespace BaseRepository.Cache;

public interface ICacheRepository
{
    Task<T?> GetOrCreateAsync<T>(string key, Func<ICacheEntry, Task<T?>> valueFactory, int baseExpireSeconds = 5 * 60);
    T? GetOrCreate<T>(string key, Func<ICacheEntry, T?> valueFactory, int baseExpireSeconds = 5 * 60);
    T? Get<T>(string key);
    void Set<T>(string key, T value, int baseExpireSeconds = 5 * 60);
    void Remove(string key);
    void Remove(List<string> keys);

    bool TryGetValue(string key, out object? value);
}